package com.usfuture.chart.techanly
{
	import flash.events.EventDispatcher;
	import flash.events.KeyboardEvent;
	import flash.geom.Point;
	import flash.ui.Keyboard;


	public class TechPropertyMode2 extends AbstractTechProperty
	{

		public function TechPropertyMode2(data:Array){
			this.data = data;
			init();
		}
		
		override protected function init():void
		{
			mode=true;
			lineWidth=10; //K线宽度
			lineMergin=lineWidth * 0.4;
			lineNum=(canvasWidth - leftWidthX - AbstractTechProperty.rightWidthX) / (lineWidth + lineMergin);
		}

		override protected function keyUpHandler():void
		{
			lineWidth+=lineWidth*0.2; //K线宽度
			if (lineWidth > 50)
				lineWidth=50;
			lineMergin=lineWidth * 0.4;
			lineNum=(canvasWidth - leftWidthX - AbstractTechProperty.rightWidthX) / (lineWidth + lineMergin);
		}

		override protected function keyDownHandler():void
		{
			lineWidth-=lineWidth*0.2;
			if (lineWidth <= 10)
				lineWidth=10;
			lineMergin=lineWidth * 0.4;
			lineNum=(canvasWidth - leftWidthX - AbstractTechProperty.rightWidthX) / (lineWidth + lineMergin);
		}

		override protected function keyLeftHandler():void
		{
			if (relativePos > 0)
				relativePos--;
			if (relativePos >= lineNum)
				relativePos=lineNum - 1;
			if (relativePos >= data.length)
				relativePos=data.length - 1;
		}

		override protected function keyRightHandler():void
		{
			relativePos++;
			if (relativePos >= lineNum)
				relativePos=lineNum - 1;
			if (relativePos >= data.length)
				relativePos=data.length - 1;
		}

	}
}